package com.cskaoyan.controller;

import com.cskaoyan.bean.*;
import com.cskaoyan.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author
 * @date 2020/12/5 20:33
 */
@RestController
@RequestMapping("admin")
public class UserController {
    @Autowired
    UserService userService;

    @RequestMapping("user/list")
    public BaseRespVo userList(Integer page, Integer limit, String sort, String order, String username, String mobile) {
        ListData<User> listData = userService.queryList(page, limit, sort, order,username,mobile);
        return BaseRespVo.ok(listData);
    }

    @RequestMapping("address/list")
    public BaseRespVo addressList(Integer page, Integer limit, String sort, String order) {
        ListData<Address> listData =  userService.queryAddressList(page, limit, sort, order);
        return BaseRespVo.ok(listData);
    }
    @RequestMapping("collect/list")
    public BaseRespVo collectList(Integer page, Integer limit, String sort, String order, Integer userId, Integer valueId) {
        ListData<Collect> listData =  userService.queryCollectList(page, limit, sort, order,userId,valueId);
        return BaseRespVo.ok(listData);
    }
    @RequestMapping("footprint/list")
    public BaseRespVo footprintList(Integer page, Integer limit, String sort, String order, Integer userId, Integer goodsId) {
        ListData<Footprint> listData =  userService.queryFootprintList(page, limit, sort, order,userId,goodsId);
        return BaseRespVo.ok(listData);
    }
    @RequestMapping("history/list")
    public BaseRespVo historyList(Integer page, Integer limit, String sort, String order, Integer userId, String keyword) {
        ListData<SearchHistory> listData =  userService.queryHistoryList(page, limit, sort, order,userId,keyword);
        return BaseRespVo.ok(listData);
    }

    @RequestMapping("feedback/list")
    public BaseRespVo feedbackList(Integer page, Integer limit, String sort, String order, Integer id, String username) {
        ListData<Feedback> listData =  userService.queryFeedbackList(page, limit, sort, order,id,username);
        return BaseRespVo.ok(listData);
    }

}
